package com.qm.console.pubdef.dto.anchor;

import com.qm.console.controller.vo.comm.query.TimeOffsetQuery;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.List;

import lombok.Getter;
import lombok.Setter;

/**
 * //                       _oo0oo_
 * //                      o8888888o
 * //                      88" . "88
 * //                      (| -_- |)
 * //                      0\  =  /0
 * //                    ___/`---'\___
 * //                  .' \\|     |// '.
 * //                 / \\|||  :  |||// \
 * //                / _||||| -:- |||||- \
 * //               |   | \\\  -  /// |   |
 * //               | \_|  ''\---/''  |_/ |
 * //               \  .-\__  '-'  ___/-. /
 * //             ___'. .'  /--.--\  `. .'___
 * //          ."" '<  `.___\_<|>_/___.' >' "".
 * //         | | :  `- \`.;`\ _ /`;.`/ - ` : | |
 * //         \  \ `_.   \_ __\ /__ _/   .-` /  /
 * //     =====`-.____`.___ \_____/___.-`___.-'=====
 * //                       `=---='
 * //
 * //
 * //     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 * //
 * //               佛祖保佑         永无BUG
 * <p>
 * com.qm.console.pubdef.dto.user
 * Created on 2020/7/31.
 */
@Getter
@Setter
public class ImMsgQueryDTO extends TimeOffsetQuery {

    private Integer userId;
    private Integer secondUserId;

    private Integer minRate;
    private Integer maxRate;

    private Integer minReplyTime;
    private Integer maxReplyTime;

    private Boolean illegal;

    private String msgType;

    private Integer valid;
    private String content;
    private List<String> tables;
    private List<Integer> msgTypes;

    private String tableName;

    private Integer fromUser;

    private Integer toUser;
    private Integer isFamily;
    private Integer familyId;
    private String startTime;

    public String getTableName() {
        Calendar calendar = Calendar.getInstance();
        if(calendar.get(Calendar.MONTH) >= 9){
            return String.format("immsg_%s_%s", calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH) + 1);
        }else {
            return String.format("immsg_%s_0%s", calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH) + 1);
        }
    }
}
